package com.speedchina.common.rsa.service;

import java.security.NoSuchAlgorithmException;
import java.util.Map;

/**
 * @author Winter
 */
public interface RSAService {
    /**
     * 根据公钥获取私钥
     * @param publicKey
     * @return
     */
    String getPrivateKey(String publicKey);

    /**
     * 存储公钥私钥键值对
     * @param publicKey
     * @param privateKey
     * @return
     */
    boolean setPublicKeyPrivateKey(String publicKey,String privateKey);

    /**
     * 移除公钥私钥键值对
     * @param publicKey
     * @return
     */
    boolean removePublicKeyPrivateKey(String publicKey);

    /**
     * 生成公钥私钥键值对
     * @return
     * @throws NoSuchAlgorithmException
     */
    Map<String,String> generatePublicKeyPrivateKey() throws NoSuchAlgorithmException;
}
